package com.queming.core.controller;

import com.queming.core.dto.TokenRequest;
import com.queming.service.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chencidiao
 * @date 2022/04/28 13:00
 **/
@RestController
@RequestMapping("/token")
public class TokenController {

    UserService userService;

    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    @PostMapping
    public String create(@RequestBody TokenRequest tokenRequest) {
        return userService.createToken(tokenRequest);
    }
}
